package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.Comment;
import com.example.vo.UserComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {

    @Select("select * from comment")
    List<Comment> getAllComments();

    @Select("select * from comment join user where user.user_id = comment.user_id and content_id = #{contentId}")
    List<UserComment> getCommentsByContentId(@Param("contentId") Long contentId);
}
